package com.ly.web.controller.erp;

import com.ly.common.core.domain.AjaxResult;
import com.ly.heart.domain.KingPayableReceivableVerificationEntity;
import com.ly.heart.domain.dto.KingPayableVerificationDto;
import com.ly.heart.domain.vo.KingPayableVerificationVo;
import com.ly.heart.service.IKingPayableReceivableVerificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 应付付款单核销单 前端控制器
 * </p>
 *
 * @author WuZH
 * @since 2024-08-12
 */
@Api ( value = "kingPayableVerification", tags = "金蝶-应付付款核销单" )
@RestController
@RequestMapping ( "/heart/kingPayableReceivableVerification" )
public class KingPayableReceivableVerificationController {

    @Resource
    private IKingPayableReceivableVerificationService iKingPayableReceivableVerificationService;

    @GetMapping ( "/list" )
    @ApiOperation ( "查询应付付款核销单列表" )
    public AjaxResult queryList ( KingPayableReceivableVerificationEntity kingPayableReceivableVerificationEntity) {
        AjaxResult ajaxResult = iKingPayableReceivableVerificationService.queryList ( kingPayableReceivableVerificationEntity );
        return ajaxResult;
    }

    @GetMapping ( "querySingle" )
    @ApiOperation ( "查询应付付款核销单详情" )
    public AjaxResult getInfo ( String id ) {
        return AjaxResult.success ( iKingPayableReceivableVerificationService.querySingle ( id ));
    }

    @GetMapping ( value = "/{id}" )
    @ApiOperation ( "通过供应商ID拉取未核销的应付单和付款单" )
    public AjaxResult loadVerificationList ( @PathVariable String id ) {
        KingPayableVerificationVo vo = iKingPayableReceivableVerificationService.loadVerificationList ( id );
        return AjaxResult.success ( vo );
    }

    @PostMapping
    @ApiOperation ( "手工核销" )
    public AjaxResult manualVerification ( @RequestBody KingPayableVerificationDto kingPayableVerificationDto ) {
        AjaxResult ajaxResult = iKingPayableReceivableVerificationService.manualVerification ( kingPayableVerificationDto );
        return ajaxResult;
    }

}
